<extend name="Base/agent"/>
<block name="content">
    <!--主体内容-->
    <div class="admin-main">
        <p class="current-title">美元订单信息</p>
        <p class="current-park"><i class="icon icon-index"></i><a href="#" class="current-index">首页</a> 〉〉 美元订单信息</p>
        <div class="current-condition">
                <select class="yorn-broker" name="status" id="status">
                    <option value="-2" <if condition="$status eq null">selected="selected"</if>>状态选择</option>
                    <option value="1" <if condition="$status eq 1">selected="selected"</if>>进行中</option>
                    <option value="2" <if condition="$status eq 2">selected="selected"</if>>已结束</option>
                </select>
                <select class="yorn-broker" name="direction" id="direction">
                    <option value="-2" <if condition="$direction eq null">selected="selected"</if>>方向选择</option>
                    <option value="1" <if condition="$direction eq 1">selected="selected"</if>>涨</option>
                    <option value="2" <if condition="$direction eq 2">selected="selected"</if>>跌</option>
                </select>
                <input type="text" name="name" id = "name" class="current-username current-click" value="{$name}" placeholder="用户名称"><br/>
                <input type="text" name="option" id = "option" class="current-username current-click" value="{$option}" placeholder="合约">
                <input type="text" id="create_time" name="start_time"  class="current-stardate current-click" value="{$start_time}" placeholder="开始时间">
                <span style = "margin-left:-15px">至</span>
                <input type="text" id="end_time" name="end_time"  class="current-stardate current-click" value="{$end_time}" placeholder="结束时间">
                <input type="button" href="javascript:;" id="search" url="{:U('index')}" value="搜索" class="current-serach"/>
                <input type="reset" id="clear" value="清空" class="current-reset"/>
        </div>
        <!--数据表格-->
        <div class="main-table-data">
            <p class="table-title clearfix" >订单信息 <a href="javascript:void(0);" class="fr current-inport" id="search_two">导出报表 ></a></p>
            <table class="current-table">
                <tr>
                    <th class="">id</th>
                    <th class="">用户</th>
                    <th class="">合约</th>
                    <th class="">合约代码</th>
                    <th class="">金额</th>
                    <th class="">当前卖价</th>
                    <th class="">平仓买价</th>
                    <th class="">方向</th>
                    <th class="">盈利</th>
                    <th class="">时长</th>
                    <th class="">收益率</th>
                    <th class="">状态</th>
                    <th class="">开始时间</th>
                    <th class="">结束时间</th>
                </tr>
            <notempty name="henData">
                <volist name="henData" id="vo">
                    <tr>
                    <td>{$vo['id']} </td>
                    <td>{$vo['nickname']} </td>
                    <td>{$vo['heyue']}</td>
                    <td>{$vo['daima']}</td>
                    <td>{$vo['invest']}<span>元</span></td>
                    <td>{$vo['buy_price']}<span>元</span></td>
                    <td>{$vo['sell_price']}<span>元</span></td>
                    <td>
                        <if condition="$vo['direction'] == 1">
                            看涨
                        <elseif  condition="$vo['direction'] == 0"/>
                            看跌
                        <elseif  condition="$vo['direction'] == 2"/>
                             2
                        </if>
                    </td>
                    <td>{$vo['profit']}<span>元</span></td>
                    <td>{$vo['duration']}<span>秒</span></td>
                    <td>{$vo['yield_rate']}</td>
                    <td>
                        <eq name="vo.status" value="1">进行中</eq>
                        <eq name="vo.status" value="2">已结束</eq>

                    </td>
                    <td><span>{$vo['start_time']|date='Y-m-d H:i:s',###}</span></td>
                    <td><span>{$vo['end_time']|date='Y-m-d H:i:s',###}</span></td>
                    </tr>
                </volist>
            <else/>
                <td colspan="15"><h2 align="center">对不起,暂时还没有数据</h2></td>
            </notempty>
            </table>
            <!--分页-->
            <div class="current-page">
                {$page->show()}
            </div>
        </div>

    </div>
    <script type="text/javascript">
        function myfunc(url){
            url = url.substr(0,url.lastIndexOf('.'));
            var query  = $('.current-condition').find('input').serialize();
            var status=$('#status').val();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            query+="/status/"+status;
            var direction=$('#direction').val();
            query+="/direction/"+direction;
            query = query.replace(/=/gm,"/");
            query = query.replace(/&/gm,"/");
            if( url.indexOf('?')>0 ){
                if(query.substr(0,1) != "/"){
                    url += "/"+query;
                }else{
                    url += query;
                }
            }else{
                url += "/" + query;
            }
            return url;
        }
        $("#search").click(function(){
            var url = $(this).attr('url');
            var url=myfunc(url);
            window.location.href = url;
        });
        $("#search_two").click(function(){
            var url="{:U('downouyuanorder')}";
            var url=myfunc(url);
            window.location.href=url;
        })
        $("#clear").click(function(){
            window.location.href="{:U('AgentGoldOrder/index')}&state=-2";
        })

    </script>
</block>
